package com.wm.template;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @ClassName: AbstractTemplate
 * @Description: 模板抽象类
 * @Author: WM
 * @Date: 2023/5/18 8:45
 */
public abstract class AbstractTemplate {

    private final static Logger logger = LoggerFactory.getLogger(AbstractTemplate.class);

    // 模板方法，用于定义核心流程和算法的定义
    public void templateMethod() {
        checkNumber();
        queueUp();
        handleBusiness();
        serviceEvaluation();
    }

    // 1：抽号
    private void checkNumber() {
        logger.info("checkNumber......");
    }

    // 2：排队
    private void queueUp() {
        logger.info("queue up......");
    }

    // 3：办理业务
    protected abstract void handleBusiness();

    // 4：服务评价
    private void serviceEvaluation() {
        logger.info("business finished, service evaluation......");
    }
}
